package com.walterweimod.auxiliary_attributes.mobeffect;

import com.walterweimod.auxiliary_attributes.attribute.ModAttributes;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.world.effect.MobEffect;
import net.minecraft.world.effect.MobEffectCategory;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.ai.attributes.AttributeMap;
import org.jetbrains.annotations.NotNull;

import java.util.UUID;

import static com.walterweimod.auxiliary_attributes.util.ModAttributeUtils.getNameAttributeUUID;
import static com.walterweimod.auxiliary_attributes.util.ModAttributeUtils.removeAttributeModifier;

public class Endurance extends MobEffect {
    private static final UUID ENDURANCE_HEAL_BONUS_UUID = getNameAttributeUUID(
            ModAttributes.HEAL_BONUS.get(),
            "endurance"
    );

    public static UUID getEnduranceHealBonusUUID(){
        return ENDURANCE_HEAL_BONUS_UUID;
    }

    protected Endurance() {
        super(MobEffectCategory.BENEFICIAL, 0xFFFFD700);
    }

    @Override
    public @NotNull Component getDisplayName() {
        return new TextComponent("Endurance");
    }

    @Override
    public void removeAttributeModifiers(@NotNull LivingEntity p_19469_,
                                         @NotNull AttributeMap p_19470_,
                                         int p_19471_) {
        removeAttributeModifier(
                p_19469_,
                ModAttributes.HEAL_BONUS.get(),
                ENDURANCE_HEAL_BONUS_UUID
        );

        super.removeAttributeModifiers(p_19469_, p_19470_, p_19471_);
    }
}
